import axios from 'axios'

export const api = axios.create({
  baseURL: 'http://localhost:8080/api',
  timeout: 10000
})

export type Warehouse = { id: number; name: string; location: string; capacity: number }
export type InventoryItem = { id: number; sku: string; name: string; quantity: number; warehouse: Warehouse }
export type OrderItem = { id?: number; sku: string; name: string; quantity: number }
export type CustomerOrder = { id: number; orderNumber: string; status: 'NEW'|'PROCESSING'|'SHIPPED'|'DELIVERED'|'CANCELLED'; createdAt: string; updatedAt?: string; warehouse: Warehouse; items: OrderItem[] }
export type Carrier = { id: number; name: string; contactEmail?: string; contactPhone?: string }
export type Shipment = { id: number; trackingNumber: string; status: 'CREATED'|'IN_TRANSIT'|'DELIVERED'|'CANCELLED'; order: CustomerOrder; carrier: Carrier; shippedAt?: string; deliveredAt?: string }


